From 3f1fa664792e53531fd07a7991ffa757997fa987 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 13 Sep 2020 17:37:05 -0400 Subject: [PATCH] Demo thyself Make gtk-demo show itself as a useful example. --- demos/gtk-demo/demo.gresource.xml | 6 ++++++ demos/gtk-demo/main.c | 26 +++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/demos/gtk-demo/demo.gresource.xml b/demos/gtk-demo/demo.gresource.xml index 238503c0d2..08b90b677a 100644 --- a/demos/gtk-demo/demo.gresource.xml +++ b/demos/gtk-demo/demo.gresource.xml @@ -176,6 +176,11 @@ color.names.txt listview_colors.css + + fontify.c + fontify.h + main.ui + shortcuts.ui shortcuts-builder.ui @@ -258,6 +263,7 @@ listview_weather.c listview_words.c list_store.c + main.c markup.c overlay.c overlay2.c diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c index 40789d773e..5d21de899a 100644 --- a/demos/gtk-demo/main.c +++ b/demos/gtk-demo/main.c @@ -1,3 +1,17 @@ +/* GTK Demo + * + * GTK Demo is a collection of useful examples to demonstrate + * GTK widgets and features. It is a useful example in itself. + * + * You can select examples in the sidebar or search for them by + * typing a search term. Double-clicking or hitting the “Run” button + * will run the demo. The source code and other resources used in the + * demo are shown in this area. + * + * You can also use the GTK Inspector, available from the menu on the + * top right, to poke at the running demos, and see how they are put + * together. + */ #include #include #include @@ -798,10 +812,20 @@ create_demo_model (void) { GListStore *store = g_list_store_new (GTK_TYPE_DEMO); DemoData *demo = gtk_demos; + GtkDemo *d; + + d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL)); + d->name = "main"; + d->title = "GTK Demo"; + d->keywords = NULL; + d->filename = "main.c"; + d->func = NULL; + + g_list_store_append (store, d); while (demo->title) { - GtkDemo *d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL)); + d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL)); DemoData *children = demo->children; d->name = demo->name; -- 2.30.2